package com.base.service.impl;

import com.base.mapper.voipmapper.BusinessNatureMapper;
import com.base.mapper.voipmapper.UsersMapper;
import com.base.po.voip.BusinessNature;
import com.base.po.voip.Users;
import com.base.service.BusinessNatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessNatureServiceImpl implements BusinessNatureService {
    @Autowired
    BusinessNatureMapper businessNatureMapper;

    @Autowired
    UsersMapper usersMapper;

    @Override
    public List<BusinessNature> getAllByStatus(String status) {
        return businessNatureMapper.findAllByStatus(status);
    }

    @Override
    public List<BusinessNature> getAllByparentId(String id) {
        return businessNatureMapper.findlastResult(id);
    }

    @Override
    public int addBussinessNature(BusinessNature businessNature) {
        String id=businessNature.getID();
        String parentid=businessNature.getParent();
        String businessId=businessNature.getBusinessId();
        String status =businessNature.getStatus();
        String tuijianren=businessNature.getTuijianren();
        String UserName=businessNature.getUserName();
        String AddressProvince=businessNature.getAddressProvince();
        String AddressCity=businessNature.getAddressCity();
        String AddressArea=businessNature.getAddressArea();
       return  businessNatureMapper.insert(id,UserName,parentid,businessId,status,AddressProvince,AddressCity,AddressArea,tuijianren);
    }

    @Override
    public List<BusinessNature> getNatureLike(String localName, String status) {
        return businessNatureMapper.getNatureLike(localName,status);
    }
}
